<!doctype html>
<html class="default no-js">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>ginkgoch-shapefile - v2.4.0</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<header>
	<div class="tsd-page-toolbar">
		<div class="container">
			<div class="table-wrap">
				<div class="table-cell" id="tsd-search" data-index="assets/js/search.js" data-base=".">
					<div class="field">
						<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
						<input id="tsd-search-field" type="text" />
					</div>
					<ul class="results">
						<li class="state loading">Preparing search index...</li>
						<li class="state failure">The search index is not available</li>
					</ul>
					<a href="index.html" class="title">ginkgoch-shapefile - v2.4.0</a>
				</div>
				<div class="table-cell" id="tsd-widgets">
					<div id="tsd-filter">
						<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
						<div class="tsd-filter-group">
							<div class="tsd-select" id="tsd-filter-visibility">
								<span class="tsd-select-label">All</span>
								<ul class="tsd-select-list">
									<li data-value="public">Public</li>
									<li data-value="protected">Public/Protected</li>
									<li data-value="private" class="selected">All</li>
								</ul>
							</div>
							<input type="checkbox" id="tsd-filter-inherited" checked />
							<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
							<input type="checkbox" id="tsd-filter-externals" checked />
							<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
							<input type="checkbox" id="tsd-filter-only-exported" />
							<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
						</div>
					</div>
					<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
				</div>
			</div>
		</div>
	</div>
	<div class="tsd-page-title">
		<div class="container">
			<ul class="tsd-breadcrumb">
				<li>
					<a href="globals.html">Globals</a>
				</li>
			</ul>
			<h1> ginkgoch-shapefile - v2.4.0</h1>
		</div>
	</div>
</header>
<div class="container container-main">
	<div class="row">
		<div class="col-8 col-content">
			<div class="tsd-panel tsd-typography">
				<a href="#ginkgoch-shapefile" id="ginkgoch-shapefile" style="color: inherit; text-decoration: none;">
					<h1>Ginkgoch Shapefile</h1>
				</a>
				<p>This is a NodeJs library to help to read/write <a href="https://en.wikipedia.org/wiki/Shapefile">Shapefile</a> from your disk. <a href="https://ginkgoch.com/node-shapefile/">API Reference</a>.</p>
				<a href="#feature-list" id="feature-list" style="color: inherit; text-decoration: none;">
					<h2>Feature List</h2>
				</a>
				<ol>
					<li>Query records from Shapefile</li>
					<li>Append new records into Shapefile</li>
					<li>Update a specified record in Shapefile</li>
					<li>Remove a record</li>
					<li>Create an empty Shapefile by a specified shape type.</li>
				</ol>
				<a href="#tutorial" id="tutorial" style="color: inherit; text-decoration: none;">
					<h2>Tutorial</h2>
				</a>
				<a href="#prerequisite" id="prerequisite" style="color: inherit; text-decoration: none;">
					<h3>Prerequisite</h3>
				</a>
				<ol>
					<li>Node.js installed in your machine.</li>
					<li>Install <code>ginkgoch-shapefile</code> package.<pre><code class="language-terminal">yarn add ginkgoch-shapefile</code></pre>
					</li>
				</ol>
				<a href="#code-template-for-querying" id="code-template-for-querying" style="color: inherit; text-decoration: none;">
					<h3>Code template for querying</h3>
				</a>
				<p>In this section, we are going to operate the Shapefile. Before kick off, we need to open the shapefile in case we have everything prepared. We provide three ways to open the shapefile. Choose either one as you use to.</p>
				<ol>
					<li><p>Regular way</p>
						<pre><code class="language-typescript"> <span class="hljs-keyword">const</span> statesShp = <span class="hljs-keyword">new</span> Shapefile(<span class="hljs-string">'./tests/data/USStates.shp'</span>);
 statesShp.open();

 <span class="hljs-comment">// put your business logic here.</span>

 statesShp.close();</code></pre>
					</li>
					<li><p>Fluent way to open</p>
						<pre><code class="language-typescript"> <span class="hljs-keyword">const</span> statesShp = <span class="hljs-keyword">new</span> Shapefile(<span class="hljs-string">'./tests/data/USStates.shp'</span>).open();

 <span class="hljs-comment">// put your business logic here.</span>

 statesShp.close();</code></pre>
					</li>
					<li><p>Callback way to open (auto close when callback complete)</p>
						<pre><code class="language-typescript"> <span class="hljs-keyword">const</span> statesShp = <span class="hljs-keyword">new</span> Shapefile(<span class="hljs-string">'./tests/data/USStates.shp'</span>).openWith(<span class="hljs-function"><span class="hljs-params">()</span> =&gt;</span> {
     <span class="hljs-comment">// put your business logic here.</span>
 });</code></pre>
					</li>
				</ol>
				<a href="#query-records" id="query-records" style="color: inherit; text-decoration: none;">
					<h3>Query Records</h3>
				</a>
				<p>In this section, we are going to show you how to iterate shapefile records, get a specific record by id, and how to work with querying filters.</p>
				<a href="#query-record-by-id" id="query-record-by-id" style="color: inherit; text-decoration: none;">
					<h4>Query record by id</h4>
				</a>
				<p>Let&#39;s start from a normal case - get record by id.</p>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> statesShp = <span class="hljs-keyword">new</span> Shapefile(<span class="hljs-string">'./tests/data/USStates.shp'</span>).open();
<span class="hljs-keyword">const</span> record = statesShp.get(<span class="hljs-number">1</span>); <span class="hljs-comment">// all ids are started from 1.</span></code></pre>
				<p>| Note: record is a structure formed with <code>geometry</code> and <code>properties</code>.</p>
				<a href="#get-all-records" id="get-all-records" style="color: inherit; text-decoration: none;">
					<h4>Get all records</h4>
				</a>
				<p>This method fetches all records at once.</p>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> records = statesShp.records();
<span class="hljs-built_in">console</span>.log(records.length);</code></pre>
				<a href="#iterate-records" id="iterate-records" style="color: inherit; text-decoration: none;">
					<h4>Iterate records</h4>
				</a>
				<p>In previous section, we get all the records at once. It is convenient but it will take much memory usage for sure. Iterator allows to get all features in another way to get records one after another.</p>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> iterator = statesShp.iterator();
<span class="hljs-keyword">let</span> record = <span class="hljs-literal">undefined</span>;
<span class="hljs-keyword">while</span> ((record = iterator.next()) &amp;&amp; !iterator.done) {
    <span class="hljs-built_in">console</span>.log(record);
}</code></pre>
				<a href="#use-filter" id="use-filter" style="color: inherit; text-decoration: none;">
					<h4>Use filter</h4>
				</a>
				<p>We allow to filter the records by following conditions.</p>
				<ol>
					<li>from - The start id of the record to fetch. Default is 1.</li>
					<li>limit - The limited record count to fetch. Default is Number.Max.</li>
					<li>envelope - The envelope structure that all the records within will be fetched. e.g. <code>{ minx: -180, miny: -90, maxx: 180, maxy: 90 }</code>.</li>
					<li>fields - The fields to fetch from dbf file. Options are:<ul>
							<li><code>undefined</code> - Not defined, by default, all fields will be fetched.</li>
							<li><code>all</code> - Same as <code>undefined</code>.</li>
							<li><code>none</code> - Ignore the dbf querying.</li>
							<li><code>string[]</code> - A specified field name list to fetch. e.g. <code>[&quot;RECID&quot;, &quot;NAME&quot;]</code>.</li>
						</ul>
					</li>
				</ol>
				<p>Here is a demo to fetch records from id <code>10</code> to <code>19</code>, properties include <code>RECID</code> and <code>STATE_NAME</code>.</p>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> records = statesShp.records({ <span class="hljs-keyword">from</span>: <span class="hljs-number">10</span>, limit: <span class="hljs-number">10</span>, fields: [<span class="hljs-string">'RECID'</span>, <span class="hljs-string">'STATE_NAME'</span>] });</code></pre>
				<a href="#code-template-for-editing" id="code-template-for-editing" style="color: inherit; text-decoration: none;">
					<h3>Code template for editing</h3>
				</a>
				<p>Before appending new record, we need to do a little change before opening the <code>Shapefile</code>. Specify the file flag to &#39;rs+&#39; or whatever flags to allow the file is able to edit.</p>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> shapefile = <span class="hljs-keyword">new</span> Shapefile(filePath, <span class="hljs-string">'rs+'</span>);
shapefile.open();

<span class="hljs-comment">// put your business logic here.</span>

shapefile.close();</code></pre>
				<a href="#append-new-record" id="append-new-record" style="color: inherit; text-decoration: none;">
					<h3>Append new record</h3>
				</a>
				<p>A <code>record</code> is named as <code>Feature</code> in Ginkgoch. Let&#39;s create a feature first. Then push this feature into <code>shapefile</code> instance. Then Done.</p>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> feature = <span class="hljs-keyword">new</span> Feature(<span class="hljs-keyword">new</span> Point(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>), { NAME: <span class="hljs-string">'Tokyo'</span>, POP: <span class="hljs-number">1.268</span> });
shapefile.push(feature);</code></pre>
				<a href="#update-a-record" id="update-a-record" style="color: inherit; text-decoration: none;">
					<h3>Update a record</h3>
				</a>
				<p>Updating a record is similar as appending a new record. The only difference is that, the feature to update requires a valid id.</p>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> feature = <span class="hljs-keyword">new</span> Feature(<span class="hljs-keyword">new</span> Point(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>), { NAME: <span class="hljs-string">'Tokyo'</span>, POP: <span class="hljs-number">1.268</span> }, <span class="hljs-number">1</span> <span class="hljs-comment">/* the record id to update */</span>);
shapefile.update(feature);</code></pre>
				<a href="#remove-a-record" id="remove-a-record" style="color: inherit; text-decoration: none;">
					<h3>Remove a record</h3>
				</a>
				<p>Specify an id to delete.</p>
				<pre><code class="language-typescript">shapefile.remove(<span class="hljs-number">1</span>); <span class="hljs-comment">// remove the record whose id is 1.</span></code></pre>
				<a href="#create-new-shapefile" id="create-new-shapefile" style="color: inherit; text-decoration: none;">
					<h3>Create new shapefile</h3>
				</a>
				<p>To create a new shapefile, we need to prepare the following factors.</p>
				<ol>
					<li>The new shapefile path to store.</li>
					<li>The shape type to contain inside. Options are: <code>point</code>, <code>polyLine</code>, <code>polygon</code> and <code>multiPoint</code>.</li>
					<li>The fields info.</li>
				</ol>
				<pre><code class="language-typescript"><span class="hljs-keyword">const</span> fields = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>&lt;DbfField&gt;();
fields.push(<span class="hljs-keyword">new</span> DbfField(<span class="hljs-string">'RECID'</span>, DbfFieldType.number));
fields.push(<span class="hljs-keyword">new</span> DbfField(<span class="hljs-string">'NAME'</span>, DbfFieldType.character, <span class="hljs-number">10</span>));

<span class="hljs-keyword">const</span> shapefile = Shapefile.createEmpty(filePath, ShapefileType.point, fields);
<span class="hljs-comment">// here the shapefile instance is created with flag 'rs+'. Call open() method to continue appending new records.</span></code></pre>
				<a href="#issues" id="issues" style="color: inherit; text-decoration: none;">
					<h2>Issues</h2>
				</a>
				<p>Contact <a href="mailto:ginkgoch@outlook.com">ginkgoch@outlook.com</a> or <a href="https://github.com/ginkgoch/node-shapefile/issues">submit an issue</a>.</p>
			</div>
		</div>
		<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
			<nav class="tsd-navigation primary">
				<ul>
					<li class="globals  ">
						<a href="globals.html"><em>Globals</em></a>
					</li>
				</ul>
			</nav>
			<nav class="tsd-navigation secondary menu-sticky">
				<ul class="before-current">
					<li class=" tsd-kind-enum">
						<a href="enums/dbffieldtype.html" class="tsd-kind-icon">Dbf<wbr>Field<wbr>Type</a>
					</li>
					<li class=" tsd-kind-enum">
						<a href="enums/shapefiletype.html" class="tsd-kind-icon">Shapefile<wbr>Type</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/dbf.html" class="tsd-kind-icon">Dbf</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/dbffield.html" class="tsd-kind-icon">Dbf<wbr>Field</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/dbffieldeditcache.html" class="tsd-kind-icon">Dbf<wbr>Field<wbr>Edit<wbr>Cache</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/dbfheader.html" class="tsd-kind-icon">Dbf<wbr>Header</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/dbfiterator.html" class="tsd-kind-icon">Dbf<wbr>Iterator</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/dbfrecord.html" class="tsd-kind-icon">Dbf<wbr>Record</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/enumutils.html" class="tsd-kind-icon">Enum<wbr>Utils</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/filterutils.html" class="tsd-kind-icon">Filter<wbr>Utils</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/geomparser.html" class="tsd-kind-icon">Geom<wbr>Parser</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/geomparserfactory.html" class="tsd-kind-icon">Geom<wbr>Parser<wbr>Factory</a>
					</li>
					<li class=" tsd-kind-class tsd-has-type-parameter">
						<a href="classes/iterator.html" class="tsd-kind-icon">Iterator</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/multipointparser.html" class="tsd-kind-icon">Multi<wbr>Point<wbr>Parser</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/openersync.html" class="tsd-kind-icon">Opener<wbr>Sync</a>
					</li>
					<li class=" tsd-kind-class tsd-has-type-parameter">
						<a href="classes/optional.html" class="tsd-kind-icon">Optional</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/pointparser.html" class="tsd-kind-icon">Point<wbr>Parser</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/polylineparser.html" class="tsd-kind-icon">Poly<wbr>Line<wbr>Parser</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/polygonparser.html" class="tsd-kind-icon">Polygon<wbr>Parser</a>
					</li>
					<li class=" tsd-kind-class tsd-is-not-exported">
						<a href="classes/ringtopolygonconverter.html" class="tsd-kind-icon">Ring<wbr>ToPolygon<wbr>Converter</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shapefile.html" class="tsd-kind-icon">Shapefile</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shapefileiterator.html" class="tsd-kind-icon">Shapefile<wbr>Iterator</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shp.html" class="tsd-kind-icon">Shp</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shpheader.html" class="tsd-kind-icon">Shp<wbr>Header</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shpiterator.html" class="tsd-kind-icon">Shp<wbr>Iterator</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shpreader.html" class="tsd-kind-icon">Shp<wbr>Reader</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shpwriter.html" class="tsd-kind-icon">Shp<wbr>Writer</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shx.html" class="tsd-kind-icon">Shx</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/shxiterator.html" class="tsd-kind-icon">Shx<wbr>Iterator</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/validators.html" class="tsd-kind-icon">Validators</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/iqueryfilter.html" class="tsd-kind-icon">IQuery<wbr>Filter</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/shxrecord.html" class="tsd-kind-icon">Shx<wbr>Record</a>
					</li>
					<li class=" tsd-kind-variable tsd-is-not-exported">
						<a href="globals.html#field_name_size" class="tsd-kind-icon">FIELD_<wbr>NAME_<wbr>SIZE</a>
					</li>
					<li class=" tsd-kind-variable tsd-is-not-exported">
						<a href="globals.html#field_size" class="tsd-kind-icon">FIELD_<wbr>SIZE</a>
					</li>
					<li class=" tsd-kind-variable tsd-is-not-exported">
						<a href="globals.html#file_type" class="tsd-kind-icon">FILE_<wbr>TYPE</a>
					</li>
					<li class=" tsd-kind-variable tsd-is-not-exported">
						<a href="globals.html#header_general_size" class="tsd-kind-icon">HEADER_<wbr>GENERAL_<wbr>SIZE</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#multipoint" class="tsd-kind-icon">multi<wbr>Point</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#point" class="tsd-kind-icon">point</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#polyline" class="tsd-kind-icon">poly<wbr>Line</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#polygon" class="tsd-kind-icon">polygon</a>
					</li>
				</ul>
			</nav>
		</div>
	</div>
</div>
<footer class="with-border-bottom">
	<div class="container">
		<h2>Legend</h2>
		<div class="tsd-legend-group">
			<ul class="tsd-legend">
				<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
				<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
				<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
				<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
				<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
				<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
				<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
				<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
				<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
				<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
				<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
				<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
				<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
				<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
				<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
				<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
				<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
			</ul>
		</div>
	</div>
</footer>
<div class="container tsd-generator">
	<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="assets/js/search.js"><' + '/script>');</script>
</body>
</html>